package com.tonghe.service.provider;

import com.tonghe.dao.BaseDao;
import com.tonghe.dao.bill.BillDao;
import com.tonghe.dao.bill.BillDaoImpl;
import com.tonghe.dao.provider.ProviderDao;
import com.tonghe.dao.provider.ProviderDaoImpl;
import com.tonghe.pojo.Provider;
import com.tonghe.service.user.UserServiceImpl;
import org.junit.Test;

import java.sql.Connection;
import java.util.List;

/**
 * @Date:2021/12/12- 12- 12- 14:01
 **/
public class ProviderServiceImpl implements ProviderService{

    private ProviderDao providerDao;
    private BillDao billDao;
    public ProviderServiceImpl(){
        providerDao = new ProviderDaoImpl();
        billDao = new BillDaoImpl();
    }

    @Override
    public List<Provider> getProviderList(String proName, String proCode) {
        Connection connection = null;
        List<Provider> providerList = null;
        System.out.println("query proName ---- > " + proName);
        System.out.println("query proCode ---- > " + proCode);
        try {
            connection = BaseDao.getConnection();
            providerList = providerDao.getProviderList(connection, proName,proCode);
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return providerList;
    }


}
